package com.tyk.bookstore.front.payment.strategy.config;

import com.alipay.easysdk.kernel.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author tyk
 * @description AliPayConfig
 */
@Configuration
public class AliPayConfig {

    @Value("${mine.pay.ali.app-id}")
    private String appId;
    @Value("${mine.pay.ali.private-key}")
    private String privateKey;
    @Value("${mine.pay.ali.public-key}")
    private String publicKey;
    @Value("${mine.pay.ali.notify-url}")
    private String notifyUrl;
    @Value("${mine.pay.ali.encrypt-key}")
    private String encryptKey;
    @Value("${mine.pay.ali.gateway-host}")
    private String gatewayHost;
    @Value("${mine.pay.ali.sign-type}")
    private String signType;


    @Bean
    public Config config() {
        Config config = new Config();
        config.protocol = "https";
        config.gatewayHost = gatewayHost;
        config.signType = signType;
        config.appId = appId;
        config.merchantPrivateKey = privateKey;
        config.alipayPublicKey = publicKey;
        config.notifyUrl = notifyUrl;
        config.encryptKey = encryptKey;
        return config;
    }
}
